package com.shanling.shanlingcontroller.bean;

import android.bluetooth.BluetoothDevice;
import android.os.Parcel;
import android.os.Parcelable;

import com.linkplay.lpvr.lpvrbean.BaseDevice;

import org.litepal.crud.LitePalSupport;

/**
 * Created by ch1 on 2019/10/12.
 */

public class MybluetoothDevice extends LitePalSupport implements Parcelable {
    private String mac;
    private String name;
    private BluetoothDevice bluetoothDevice;
    private int type;//1  2819p 2. 2819  3 usr
    private boolean ischeck;
    private String current_Version;
    private String new_Version;

    public MybluetoothDevice(){

    }
    public MybluetoothDevice(BluetoothDevice bluetoothDevice, int type,String name ,String mac) {
        this.bluetoothDevice = bluetoothDevice;
        this.type = type;
        this.name=name;
        this.mac=mac;
    }

    protected MybluetoothDevice(Parcel in) {
        mac = in.readString();
        name = in.readString();
        bluetoothDevice = in.readParcelable(BluetoothDevice.class.getClassLoader());
        type = in.readInt();
        ischeck = in.readByte() != 0;
    }

    public static final Creator<MybluetoothDevice> CREATOR = new Creator<MybluetoothDevice>() {
        @Override
        public MybluetoothDevice createFromParcel(Parcel in) {
            return new MybluetoothDevice(in);
        }

        @Override
        public MybluetoothDevice[] newArray(int size) {
            return new MybluetoothDevice[size];
        }
    };

    public BluetoothDevice getBluetoothDevice() {
        return bluetoothDevice;
    }

    public void setBluetoothDevice(BluetoothDevice bluetoothDevice) {
        this.bluetoothDevice = bluetoothDevice;
    }
    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }



    @Override
    public String toString() {
        return "MybluetoothDevice{" +
                "mac='" + mac + '\'' +
                ", name='" + name + '\'' +
                ", bluetoothDevice=" + bluetoothDevice +
                ", type=" + type +
                '}';
    }

    public boolean isIscheck() {
        return ischeck;
    }

    public void setIscheck(boolean ischeck) {
        this.ischeck = ischeck;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(mac);
        dest.writeString(name);
        dest.writeParcelable(bluetoothDevice, flags);
        dest.writeInt(type);
        dest.writeByte((byte) (ischeck ? 1 : 0));
    }

    public String getCurrent_Version() {
        return current_Version;
    }

    public void setCurrent_Version(String current_Version) {
        this.current_Version = current_Version;
    }

    public String getNew_Version() {
        return new_Version;
    }

    public void setNew_Version(String new_Version) {
        this.new_Version = new_Version;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MybluetoothDevice that = (MybluetoothDevice) o;

        return mac != null ? mac.equals(that.mac) : that.mac == null;
    }

    @Override
    public int hashCode() {
        return mac != null ? mac.hashCode() : 0;
    }
}
